@include('admin.header')

	<style>
	  .opartion {
	    width: 5%;
	  }

	  .pagination {
	    list-style: none;
	    float: right;
	  }

	  .pagination li {
	    float: left;
	    padding-left: 5px;
	    padding-right: 5px;
	  }

	  .input_search {
	    margin-top: 10px;
	  }
	</style>
<!--[if IE 6]>
<script type="text/javascript" src="__PUBLIC__/admin/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>管理员列表</title>
</head>
<body class="pos-r">
<!--<div class="pos-a" style="width:200px;left:0;top:0; bottom:0; height:100%; border-right:1px solid #e5e5e5; background-color:#f5f5f5; overflow:auto;">-->
	<!--<ul id="treeDemo" class="ztree"></ul>-->
<!--</div>-->
<div style="">
	<div class="page-container">
		<div class="mt-20">

			<div class="table-actions">
				</div>
				<table class="table table-hover table-bordered table-list">
					<thead>
						<tr>
							<th>图片名</th>
							<th>预览图</th>
							<th>排序</th>
							<th>操作</th>
						</tr>
					</thead>
					@foreach($data as $key => $vo)
						<tr>
							<td>{{$vo->title}}</td>
							<td><img width='80' src="{{$vo->img_url}}"></td>
							<td>{{$vo->rank}}</td>
							<td>
	          					 <a href="{{asset('banner/add')}}?id={{$vo->id}}">编辑</a>
								 <a href="javascript:void(0)" rel="{{$vo->id}}" class="js-mobile-delete">删除</a>
						   </td>
						</tr>
					@endforeach
					
				</table>

			 <!-- 分页 -->
    @if (!empty($data))
    <div class="page_list">
        {{$data->links()}}
    </div>
    @endif
		</div>
		
	</div>
</div>


    <script src="/static/js/H-ui.min.js"></script>


<script type="text/javascript">
$(function() {
	$('.js-mobile-delete').click(function(){
		var id = $(this).attr('rel');
		layer.confirm('你确定要删除吗？', {
			btn: ['确定','取消']
		}, function(){
			$.post('{{asset("banner/del")}}',{id:id},function (msg) {
				if(msg.status == 1){
					layer.alert(msg.info, {
						title: '提示',
						icon: 1,
					});
					window.location.href = '{{asset("banner/list")}}';
				}else{
					layer.alert(msg.info, {
						title: '提示',
						icon: 2,
					});
				}
			},'json');
		},function() {

		});
	});
});


/*菜单栏-删除选中*/
function datadel(){
	if($("input[name='id']").length > 0){
		if ($("input[name='id']:checked").length == 0) {
			layer.msg('请选择要操作的数据项！');
			return false;
		}
		var itemids = new Array();
		$("input[name='id']:checked").each(function(i){
			itemids[i] = $(this).val();
		});
		product_del('',itemids);
	} else{
		layer.msg('请选择要操作的数据项！');
	}

}

/*菜单栏-删除*/
function product_del(obj,ids){
	if (typeof ids == 'number') {
		var ids = new Array(ids.toString());
	};
	var id = ids.join(',');
	layer.confirm('你确定要删除吗？', {
		btn: ['确定','取消']
	}, function(){
		$.post('{{asset("admin/adminDel")}}',{id:id},function (msg) {
			if(msg.status == 1){
				layer.alert(msg.info, {
					title: '提示',
					icon: 1,
				});
				window.location.href = '{{asset("admin/adminList")}}';
			}else{
				layer.alert(msg.info, {
					title: '提示',
					icon: 2,
				});
			}
		},'json');
	},function() {

	});
}


</script>
</body>
</html>